import { unsafeStringify as b } from './stringify.js';
import h from './parse.js';
function c(n) {
  n = decodeURIComponent(encodeURIComponent(n));
  const i = [];
  for (let e = 0; e < n.length; ++e) i.push(n.charCodeAt(e));
  return i;
}
const l = '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
  U = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
function x(n, i, e) {
  function f(o, r, g, y) {
    if (
      (typeof o == 'string' && (o = c(o)),
      typeof r == 'string' && (r = h(r)),
      (r == null ? void 0 : r.length) !== 16)
    )
      throw TypeError(
        'Namespace must be array-like (16 iterable integer values, 0-255)',
      );
    let t = new Uint8Array(16 + o.length);
    if (
      (t.set(r),
      t.set(o, r.length),
      (t = e(t)),
      (t[6] = (t[6] & 15) | i),
      (t[8] = (t[8] & 63) | 128),
      g)
    ) {
      y = y || 0;
      for (let d = 0; d < 16; ++d) g[y + d] = t[d];
      return g;
    }
    return b(t);
  }
  try {
    f.name = n;
  } catch {}
  return (f.DNS = l), (f.URL = U), f;
}
export { l as DNS, U as URL, x as default };
